package com.jxx.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
//作用:指定系统返回值vo对象,与前端进行交互
public class SysResult {
    private Integer status; //200成功 201失败
    private String msg;     //服务器返回的提示信息
    private Object data;    //服务器数据

    //1.编辑失败方法
    public static SysResult fail(){
        return new SysResult(201,"服务器调用失败",null);
    }
    public static SysResult fail(String msg){
        return new SysResult(201,msg,null);
    }

    //2.重载成功方法
    public static SysResult success(){
        return new SysResult(200,"服务器执行成功",null);
    }

    //2.重载成功方法
    public static SysResult success(Object data){
        return new SysResult(200,"服务器执行成功",data);
    }

    //2.重载成功方法
    public static SysResult success(String msg,Object data){
        return new SysResult(200,msg,data);
    }
}
